package ru.vsu.amm.scenes;

import org.jzy3d.chart.Chart;
import org.jzy3d.global.Settings;
import ru.vsu.amm.scenes.extensions.ZoomChartLauncher;

import java.awt.*;


public class DemoLauncher {
    /**
     * Opens a demo with mouse/key/thread controllers for viewpoint change.
     */
    public static void openDemo(IDemo demo) throws Exception {
        openDemo(demo, DEFAULT_WINDOW);
    }

    public static void openDemo(IDemo demo, Rectangle rectangle) throws Exception {
        Settings.getInstance().setHardwareAccelerated(true);
        demo.init();
        Chart chart = demo.getChart();

        ZoomChartLauncher.instructions();
        ZoomChartLauncher.openChart(chart, rectangle, demo.getName());
    }

    protected static Rectangle DEFAULT_WINDOW = new Rectangle(0, 0, 600, 600);
}

